import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import java.io.BufferedReader;
import java.io.IOException;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.*;

public class ConsoleReaderTest {

    private BufferedReader bufferedReader;
    private ConsoleReader consoleReader;

    @Before
    public void setUp() throws Exception {

        bufferedReader = mock(BufferedReader.class);
        consoleReader = new ConsoleReader(bufferedReader);
    }

    @Test
    public void consoleReaderShouldCallBufferedReaderReadLineWhenReading() throws IOException {
        when(bufferedReader.readLine()).thenReturn("1");
        consoleReader.readLine();
       assertThat(consoleReader.readLine(), is("1"));
    }

}
